home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 34.zip / BS1 part 34 / source code vol 1.adf / SMALLROUTS / JOYSTICK.S < prev    next >
Text File  |  1999-09-26  |  2KB  |  76 lines

  1. J:
  2.  
  3.       MOVE.L   #COPPER,$DFF080
  4.       ROXL.W   $DFF088
  5. GETJOY: 
  6.           ; Test FIRE
  7.  
  8.           tst.b    $bfe001            
  9.           bpl      QUIT               
  10.  
  11.           move.l   #$dff00c,a0        
  12.           clr.l    d0                 
  13.           move.w   (a0),d0            
  14.  
  15.           ; Test LEFT
  16.  
  17.           btst     #9,d0              
  18.           beq      RIGHT              
  19.       bsr      rotate
  20.       btst     #8,d0
  21.       beq      notup
  22.       move.w   #$0f0f,col+2
  23.           jmp      GETJOY             
  24. notup:    btst     #0,d0
  25.       beq      notdown
  26.       move.w   #$0ff0,col+2
  27.       jmp      GETJOY
  28. notdown:  move.w   #$0f00,col+2
  29.           jmp      GETJOY             
  30.  
  31.           ; Test RIGHT
  32.  
  33. RIGHT:    btst     #1,d0              
  34.           beq      up
  35.       bsr      rotate
  36.       btst       #8,d0
  37.       beq      notup2
  38.       move.w   #$666,col+2
  39.       jmp        GETJOY
  40. notup2:   btst     #0,d0
  41.       beq      notdown2
  42.       move.w   #$006,col+2
  43.       jmp      GETJOY
  44. notdown2:
  45.           move.w   #$00f0,col+2
  46.           jmp      GETJOY             
  47.  
  48. ROTATE:   move.l   d0,d1              
  49.           lsr.l    #1,d0              
  50.           eor.l    d1,d0              
  51.       rts
  52.  
  53.           ; Test UP
  54.  
  55. up:      bsr rotate
  56.           btst     #8,d0              
  57.           beq      DOWN               
  58.           move.w   #$000f,col+2
  59.           jmp      GETJOY             
  60.  
  61.           ; Test DOWN
  62.  
  63. DOWN:     btst     #0,d0              
  64.           beq      NOJOY              
  65.           move.w   #$0fff,col+2
  66.           jmp      GETJOY             
  67.  
  68. NOJOY:    move.w   #$0000,col+2
  69.           jmp      GETJOY             
  70.  
  71. QUIT:     rts                       
  72.  
  73. COPPER:   DC.W $0100,$0200
  74. COL:      DC.W $0180,$0000
  75.       DC.W $FFFF,$FFFE
  76.